package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

/**
 * @Author: Rodgers
 * @Date 2022/3/15 9:26
 */
public interface UserMapper {

    //新增用户操作
    @Insert("insert into user(id,phone,status) values(null,#{phone},#{status}) ")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    Integer save(User user);

    @Select("select * from user where phone=#{phone}")
    User findByPhone(String phone);

    @Select("select * from user where id =#{userId}")
    User findById(Long userId);
}
